//
//  XYNavigationController.m
//  新项目
//
//  Created by xmy on 2017/2/22.
//  Copyright © 2017年 xmy. All rights reserved.
//

#import "XYNavigationController.h"
#import "UIBarButtonItem+MYBarButtonItem.h"

@interface XYNavigationController ()

@end

@implementation XYNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}
-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
    
    if(self.childViewControllers.count > 0)
    {
        NSString *title = @"返回";
        
        viewController.navigationItem.leftBarButtonItem = [UIBarButtonItem barWithImageName:@"navigationbar_back_withtext" title:title target:self action:@selector(pop)];
        
    }
    
    //隐藏tabar
    //    viewController.hidesBottomBarWhenPushed = true;
    
    [super pushViewController:viewController animated:true];
    
}

- (void)pop{
    [self popViewControllerAnimated:true];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
